package entity;

import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class ResultVO {

    Integer resultCode;

    String errorMsg;

    Object data;

    private ResultVO() {
    }

    public static ResultVO success(String msg, Object data) {
        ResultVO resultVO = new ResultVO();
        resultVO.resultCode = 200;
        resultVO.errorMsg = msg;
        resultVO.data = data;
        return resultVO;
    }

    public static ResultVO success() {
        return success(null, null);
    }

    public static ResultVO success(Object data) {
        return success("请求成功", data);
    }

    public static ResultVO error(String s) {
        ResultVO resultVO = new ResultVO();
        resultVO.resultCode = -1;
        resultVO.errorMsg = s;
        return resultVO;
    }
}
